package edu.vt.cbil.dataset;

import edu.vt.cbil.util.Histogram;

import java.io.Serializable;
import java.util.*;

/**
 * Created by Justin on 2015/1/13.
 */
public class ResultContainer implements Serializable {

    private static final long serialVersionUID = 1809883377669957209L;
    public List<Map<Long, Integer[]>> probeSetGraph;

    private Map<String, Double> purityMap;
    private Map<String, Double> ploidyMap;

    public ResultContainer() {
        probeSetGraph = new ArrayList<Map<Long, Integer[]>>();
        // U 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 U X Y MT
        for (int i = 0; i < 27; i++) {
            probeSetGraph.add(new TreeMap<Long, Integer[]>());
        }

        purityMap = new HashMap<String, Double>();
        ploidyMap = new HashMap<String, Double>();
    }

    public void setPurity(String sampleId, double purity) {
        purityMap.put(sampleId, purity);
    }

    public double getPurity(String sampleId) {
        return purityMap.get(sampleId);
    }

    public double getPloidy(String sampleId) {
        return ploidyMap.get(sampleId);
    }

    public void setPloidy(String sampleId, double ploidy) {
        this.ploidyMap.put(sampleId, ploidy);
    }

    public boolean containsSampleId(String sampleId) {
        return ploidyMap.containsKey(sampleId);
    }

    public String printPurityHistogram() {
        Histogram h = new Histogram(32, 0, 1);
        for (Double value : purityMap.values()) {
            h.addDataPoint(value);
        }
        return h.toString("purity Histogram of samples:");
    }
}
